﻿using System;
using System.Collections;
using System.Collections.Generic;

using Wsitech.Model;
using Wsitech.Persistence.Interface;

namespace Wsitech.Persistence.Dao
{
	/// <summary>
	/// 功能：     AdminUser业务接口的实现
	/// 作者：     LI
 	/// 日期：     5/16/2012
 	/// 修改日期： 
 	/// 修改人：
 	/// 修改内容：
	/// </summary>
	public class AdminUserSqlMapDao : BaseSqlMapDao,IAdminUserDao
	{
		private AdminUserSqlMapDao ()
		{
			//
			// TODO: 此处添加AdminUserSqlMapDao的构造函数
			//
		}
		
		#region 懒汉单例模式
		
		private static AdminUserSqlMapDao instance =null;
		private static object syncRoot = new object();
		public static IAdminUserDao Instance
        {
            get 
            {
                if (instance == null)
                {
                    lock (syncRoot)
                    {
                        if (instance == null)
                        {
                            instance = new AdminUserSqlMapDao();
                        }
                    }
                }
                return instance;
            }
        }
		
		#endregion
		
		#region	基本功能 ，不可修改
		
		/// <summary>
		/// 得到明细
		/// </summary>
		/// <param name="UserID"></param>
		/// <returns></returns>
		public AdminUser GetDetail(System.String userid)
		{
			try
			{
				return ExecuteQueryForObject< AdminUser>("SelectAdminUser",userid) as AdminUser;
			}
            catch
            {
                throw;
            }
		}
		
		/// <summary>
		/// 得到列表
		/// </summary>
		/// <returns></returns>
		public System.Collections.Generic.IList< AdminUser> GetList()
		{
			try
			{
				return ExecuteQueryForList< AdminUser>("SelectAdminUser",null);
			}
            catch
            {
                throw;
            }
		}
		
		/// <summary>
		/// 通过不同参数得到列表
		/// </summary>
		/// <param name="objParameters"></param>
		/// <returns></returns>
		public System.Collections.Generic.IList< AdminUser> GetListByParams(object objParameters)
		{
			try
			{
				return ExecuteQueryForList< AdminUser>("SelectAdminUserByParams",objParameters);
			}
            catch
            {
                throw;
            }
		}
		
		
		
		/// <summary>
        /// 新建
        /// </summary>
        /// <param name="adminuser"></param>
        /// <returns></returns>
		public object Add(AdminUser adminuser)
		{
			//int id = GetId("AdminUser");
			//adminuser.UserID = id;
			
			try
			{
				return ExecuteInsert("InsertAdminUser",adminuser);
			}
            catch
            {
                throw;
            }
		}
		
		/// <summary>
        /// 修改
        /// </summary>
        /// <param name="adminuser"></param>
        /// <returns></returns>
		public int Update(AdminUser adminuser)
		{
			try
			{
				return ExecuteUpdate("UpdateAdminUser",adminuser);
			}
            catch
            {
                throw;
            }			
		}

		/// <summary>
		/// 删除
		/// </summary>
		/// <param name="UserID"></param>
		/// <returns></returns>
		public int Delete(System.String userid)
		{
			try
			{
				return ExecuteDelete("DeleteAdminUser",userid);
			}
            catch
            {
                throw;
            }
		}
		#endregion
		
		#region 扩展功能
		
		#endregion
	}
}
